home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / C⁄C++ OS8 / AMReminder / ReminderPanel.cp < prev    next >
Encoding:
Text File  |  1998-10-17  |  2.1 KB  |  106 lines  |  [TEXT/CWIE]

  1. // ReminderPanel.cp
  2.  
  3. #include <Types.h>
  4. #include <Quickdraw.h>
  5. #include <Controls.h>
  6. #include <Dialogs.h>
  7. #include <Events.h>
  8. #include <Lists.h>
  9. #include <Menus.h>
  10. #include <Resources.h>
  11. #include <Sound.h>
  12. #include <TextEdit.h>
  13. #include <ToolUtils.h>
  14. #include <Appearance.h>
  15.  
  16. #include "Globals.h"
  17. #include "ResourceDefs.h"
  18. #include "ControlUtils.h"
  19. #include "DReminder.h"
  20. #include "ReminderPanel.h"
  21.  
  22. //----------
  23. ReminderPanel*        ReminderPanel::Create (
  24.     WindowPtr        inWindow)
  25. {
  26.     ReminderPanel*        panel = new ReminderPanel;
  27.  
  28.     if (panel != nil) {
  29.         panel->MakeItems (inWindow);
  30.     }
  31.  
  32.     return panel;
  33. }
  34.  
  35. //----------
  36. ReminderPanel::ReminderPanel ()
  37. {
  38.     mData = nil;
  39. }
  40.  
  41. //----------
  42. ReminderPanel::~ReminderPanel ()
  43. {
  44. }
  45.  
  46. //----------
  47. void    ReminderPanel::MakeItems (
  48.     WindowPtr        inWindow)
  49. {
  50.     WindowPtr        window;
  51.     Handle            wftb;
  52.  
  53.     window = inWindow;
  54.     wftb = ::GetResource ('Wftb', WIND_Reminder);
  55.  
  56.     mPanelRoot = MakeRoot (window);
  57.  
  58.  
  59.     mDateLabel = GetNewControl (CNTL_Date, window);
  60.     EmbedControl (mDateLabel, mPanelRoot);
  61.     SetWindowItemFont (mDateLabel, wftb, 1);
  62.  
  63.     mTimeLabel = GetNewControl (CNTL_Time, window);
  64.     EmbedControl (mTimeLabel, mPanelRoot);
  65.     SetWindowItemFont (mTimeLabel, wftb, 2);
  66.  
  67.     mMessageLabel = GetNewControl (CNTL_Message, window);
  68.     EmbedControl (mMessageLabel, mPanelRoot);
  69.     SetWindowItemFont (mMessageLabel, wftb, 3);
  70.  
  71.     mLineHandle = ::GetNewControl (CNTL_Line, window);
  72.     EmbedControl (mLineHandle, mPanelRoot);
  73.     SetWindowItemFont (mLineHandle, wftb, 4);
  74. }
  75.  
  76. //----------
  77. void    ReminderPanel::ConnectToData (
  78.     AMSignaler*        inData)
  79. {
  80.     AMPanel::ConnectToData (inData);
  81.     mData = (DReminder*) inData;
  82.  
  83.     if (mData != nil) {
  84.         SetControlText (mDateLabel, mData->GetDateString ());
  85.         SetControlText (mTimeLabel, mData->GetTimeString ());
  86.         SetControlText (mMessageLabel, mData->GetMessage ());
  87.     }
  88. }
  89.  
  90. //----------
  91. void    ReminderPanel::DataChanged (
  92.     long        inDataID)
  93. {
  94.     if (mData != nil) {
  95.         if (inDataID == idDateString) {
  96.             SetControlText (mDateLabel, mData->GetDateString ());
  97.         }
  98.         if (inDataID == idTimeString) {
  99.             SetControlText (mTimeLabel, mData->GetTimeString ());
  100.         }
  101.         if (inDataID == idMessage) {
  102.             SetControlText (mMessageLabel, mData->GetMessage ());
  103.         }
  104.     }
  105. }
  106.